import { Button } from "antd";
import React, { useState } from "react";

interface ChildProps {
  name: string;
}
function Child(props: ChildProps) {
  const [yName] = useState<string>(props.name);

  console.log(yName);

  return (
    <>
      <h3>Child-{yName}</h3>
    </>
  );
}

const StateFormProp: React.FC = () => {
  const [name, setName] = useState<string>("xmz");

  return (
    <>
      <h3>StateFormProp</h3>
      <Button onClick={() => setName("qff")}>改变名字</Button>
      <Child name={name} />
    </>
  );
};
export default StateFormProp;
